package com.yixun.qfbao.model.enums;

/**
 * 价格枚举
 * @author zilong.liu
 *
 */
public enum AreaEnum {

	AREA_0_50(1, "50㎡以下", 0, 50),
	AREA_50_70(2, "50-70㎡", 50, 70),
	AREA_70_90(3, "70-90㎡", 70, 90),
	AREA_90_110(4, "90-110㎡", 90, 110),
	AREA_110_150(5, "110-150㎡", 110, 150),
	AREA_150_MAX(6, "150㎡以上", 150, Integer.MAX_VALUE);
	
	private int no;
	
	private String des;
	
	private int minArea;
	
	private int maxArea;

	AreaEnum(int no, String des, int minArea, int maxArea){
		this.no = no;
		this.des = des;
		this.minArea = minArea;
		this.maxArea = maxArea;
	}
	
	/**
	 * 根据number查找最小最大值
	 * @param number
	 * @return
	 */
	public static int[] getMinAndMaxValueByNumber(int number) {
		for (AreaEnum areaEnum : AreaEnum.values()) {
			if(number == areaEnum.getNo()) {
				return new int[] {areaEnum.getMinArea(), areaEnum.getMaxArea()};
			}
		}
		return null;
	}
	
	/**
	 * 根据number 查找描述
	 * @param number
	 * @return
	 */
	public static String getDescByNumber(int number) {
		for (AreaEnum areaEnum : AreaEnum.values()) {
			if(number == areaEnum.getNo()) {
				return areaEnum.getDes();
			}
		}
		return "";
	}
	
	public int getNo() {
		return no;
	}

	public String getDes() {
		return des;
	}

	public int getMinArea() {
		return minArea;
	}

	public int getMaxArea() {
		return maxArea;
	}

}
